<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
	<jsp:include page="../common/header.jsp"/>
	<jsp:include page="../../common/mydate.jsp"></jsp:include>
	<jsp:include page="../../common/validform.jsp"></jsp:include>
	<jsp:include page="../../common/layer.jsp"></jsp:include>
	<jsp:include page="../../common/webupload.jsp"></jsp:include>
	<jsp:include page="../../common/ueditor.jsp"></jsp:include>
</head>
<body>
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="${pathUrl}/admin/news/index">新闻管理</a></li>
        <li><a href="#">新增</a></li>
    </ul>
</div>
<form action="${pathUrl}/admin/news/saveOrUpdate" class="vfrom" enctype="multipart/form-data" method="post"  enctype="application/x-www-form-urlencoded">
<input type="hidden" name="id" value="${news.id }">
<input type="hidden" name="is_add" value="${is_add }">
<div class="session-main">
    <div class="formbody">
        <ul class="forminfo">
           <li><label>新闻标题<b>*</b></label><input id="newsTitle"  datatype="*" nullmsg="请输入新闻标题！"  value="${news.newsTitle }" name="newsTitle" type="text" class="dfinput"><i  class="Validform_checktip">请输入新闻标题</i></li>
            <li><label>简标题<b>*</b></label><input id="subTitle"   datatype="*" nullmsg="请输入简标题！" value="${news.subTitle }"  name=subTitle type="text" class="dfinput"><i  class="Validform_checktip">请输入简标题</i></li>
            <li><label>新闻缩略图<b>*</b></label>
            	<input id="newsImg" name="newsImg" type="hidden" value="${news.newsImg}" >
            	<span id="newsImgDiv" style="display: inline-block;">选择文件</span>
            	<span id="tupian" style="display: inline-block;"></span>
            	<c:if test="${!empty  news.newsImg}">
            		<img alt="" src="${pathUrl}${news.newsImg}" style="width: 30px;height: 30px;">
            	</c:if>
            </li>
            <li><label>新闻类型<b>*</b></label>
                
            	<select name="catalogId">
            	
            	<c:forEach var="vo" items="${newsCatalogVos }">
            		 <c:choose>
            		   <c:when test="${news.catalogId eq vo.newsCatalog.id }">
            		   		<option value="${vo.newsCatalog.id }" selected="selected">|-${vo.newsCatalog.name }</option>
            		   </c:when>
            		   <c:otherwise>
            		   	<option value="${vo.newsCatalog.id }" >|-${vo.newsCatalog.name }</option>
            		   </c:otherwise>
            		 </c:choose>
            		 <c:forEach var="childer" items="${vo.newsCatalogs }">
	            		  <c:choose>
	            		   <c:when test="${news.catalogId eq childer.id }">
	            		   		<option value="${childer.id }" selected="selected">|-${childer.name }</option>
	            		   </c:when>
	            		   <c:otherwise>
	            		   	<option value="${childer.id }" >&nbsp;&nbsp;&nbsp;&nbsp;|-${childer.name }</option>
	            		   </c:otherwise>
	            		 </c:choose>
            		 </c:forEach>
            	</c:forEach>
            	</select>
            </li>
            <li><label>预览数量<b>*</b></label><input id="countClick" value="${news.countClick }" name="countClick" type="text" class="dfinput"><i>输入预览数量</i></li>
            <li><label>评论数量<b>*</b></label><input id="commentCount" value="${news.commentCount}" name="commentCount" type="text" class="dfinput"><i>输入评论数量</i></li>
            <li><label>是否显示<b>*</b></label>
            <c:choose>
              <c:when test="${news.isShow eq 1 }">
              <cite><input name="isShow" type="radio" value="1" checked="checked">是&nbsp;&nbsp;&nbsp;&nbsp;<input name="isShow" type="radio" value="0">否</cite>
              </c:when>
              <c:otherwise>
              <cite><input name="isShow" type="radio" value="1" >是&nbsp;&nbsp;&nbsp;&nbsp;<input checked="checked" name="isShow" type="radio" value="0">否</cite>
              </c:otherwise>
            </c:choose>
            </li>
            <li><label>描述<b>*</b></label></li>
            <li><textarea name="description" id="description" cols="" rows="" >${news.description }</textarea></li>
            <li><label>&nbsp;</label><input name="" type="submit" class="btn" value="确认保存">
               <input type="button" class="btn" onclick="javascript:window.location.href='${pathUrl}/admin/news/index'" value="返回" style=" background: #57e980;">
            </li>
        </ul>
    </div>
</div>
</form>
    <script type="text/javascript">
   $(function(){
       $(".vfrom").Validform();
         
	    var ue = UE.getEditor('description');
	    
	    createWebUploader("#newsImgDiv",function(result){
	    	$("#newsImg").val(result.data.url);
	    	$("#tupian").empty();
	    	$("#tupian").html("<a href='${pathUrl}"+result.data.url+"' target='_black'><img src='${pathUrl}"+result.data.url+"' style='width: 40px;height:40px;'/></a>");
	    });
	
   });
 </script>
</body>
</html>